package org.xinjiang.data.migration.flush.controller;

import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xinjiang.data.migration.common.response.Result;
import org.xinjiang.data.migration.flush.dto.res.FlushResultDTO;
import org.xinjiang.data.migration.flush.service.IAreaFlushService;

/**
 * @Description: 地区数据同步
 */
@Api(tags = "地区数据同步")
@RestController
@RequestMapping("/flush/area")
@Slf4j
public class AreaController {
    @Autowired
    private IAreaFlushService areaFlushService;

    /**
     * 全量刷数据
     *
     * @return Result<FlushResultDTO>
     */
    @Operation(summary = "全量刷数据")
    @PostMapping(value = "/execute-all")
    public Result<FlushResultDTO> executeAll() {
        FlushResultDTO result = areaFlushService.flush();
        return Result.ok(result);
    }
}
